l = [[1983, 1],
     [1971, 0],
     [1992, 1],
     [1991, 0],
     [1961, 0],
     [1974, 0],
     [1974, 0],
     [1990, 1],
     [1953, 0],
     [1999, 0],
     [1986, 0],
     [1987, 0],
     [1962, 1],
     [1990, 1],
     [1976, 0],
     [1997, 0],
     [1988, 0],
     [1996, 1],
     [1962, 1],
     [1969, 1]]

ages = []
l = sorted(l)
a7_15 = 0
a15_25 = 0
a25_35 = 0
a35_45 = 0
a45_55 = 0
a55_65 = 0
a65 = 0
for x in l:
    age = 2022 - x[0]
    gender = '男' if x[1] == 0 else "女"
    if 7 < age < 15:
        a7_15 += 1
        # print(f'性别{gender}', end=', ')
    elif 15 < age <= 25:
        a15_25 += 1
        # print(f'性别{gender}', end=', ')
    elif 25 < age <= 35:
        a25_35 += 1
        # print(f'性别{gender}', end=', ')
    elif 35 < age <= 45:
        a35_45 += 1
        # print(f'性别{gender}', end=', ')
    elif 45 < age <= 55:
        a45_55 += 1
        # print(f'性别{gender}', end=', ')
    elif 55 < age <= 65:
        a55_65 += 1
        # print(f'性别{gender}', end=', ')
    else:
        a65 += 1
        # print(f'性别{gender}', end=', ')

    gender = '男' if x[1] == 0 else '女'
    print(f'年龄{age}, 性别{gender}')

print(f'7_15: {a7_15}')
print(f'15_25: {a15_25}')
print(f'25_35: {a25_35}')
print(f'35_45: {a35_45}')
print(f'45_55: {a45_55}')
print(f'55_65: {a55_65}')
print(f'65: {a65}')
